package com.xlfc.serialization.serializtion.json;
import com.alibaba.fastjson.JSON;
import com.xlfc.serialization.serializtion.Serializer;

import java.io.IOException;

public class JSONSerializer implements Serializer {
    @Override
    public byte[] serialize(Object object) throws IOException {
        return JSON.toJSONBytes(object);
    }

    @Override
    public <T> T deserialize(byte[] bytes,Class<T> clazz) throws IOException {
        return JSON.parseObject(bytes, clazz);
    }
}